﻿Imports System.IO

<Serializable()> _
Public Class ObjectTypePropertyTemplate

    Private _ID As Guid
    Public Property ID() As Guid
        Get
            Return _ID
        End Get
        Set(ByVal value As Guid)
            _ID = value
        End Set
    End Property

    Private _ObjectTypeTemplate_ID As Guid
    Public Property ObjectTypeTemplate_ID() As Guid
        Get
            Return _ObjectTypeTemplate_ID
        End Get
        Set(ByVal value As Guid)
            _ObjectTypeTemplate_ID = value
        End Set
    End Property

    Private _Name As String
    Public Property Name() As String
        Get
            Return _Name
        End Get
        Set(ByVal value As String)
            _Name = value
        End Set
    End Property

    Private _Datatype As String
    Public Property Datatype() As String
        Get
            Return _Datatype
        End Get
        Set(ByVal value As String)
            _Datatype = value
        End Set
    End Property

    Private _FieldDefinition As enmFieldDefinitions
    Public Property FieldDefinition() As enmFieldDefinitions
        Get
            Return _FieldDefinition
        End Get
        Set(ByVal value As enmFieldDefinitions)
            If Not [Enum].IsDefined(GetType(enmFieldDefinitions), value) Then Throw New ArgumentException
            _FieldDefinition = value
        End Set
    End Property

    Private _EmptyAllowed As Boolean
    Public Property EmptyAllowed() As Boolean
        Get
            Return _EmptyAllowed
        End Get
        Set(ByVal value As Boolean)
            _EmptyAllowed = value
        End Set
    End Property

    Private _SortOrder As Integer
    Public Property SortOrder() As Integer
        Get
            Return _SortOrder
        End Get
        Set(ByVal value As Integer)
            _SortOrder = value
        End Set
    End Property

    Private _IsSystem As Boolean
    Public Property IsSystem() As Boolean
        Get
            Return _IsSystem
        End Get
        Set(ByVal value As Boolean)
            _IsSystem = value
        End Set
    End Property

    Public Overloads Function ToString(ByVal aLevelToIdent As Integer)
        Dim myIdent As String = String.Empty
        For I As Integer = 0 To aLevelToIdent
            myIdent &= vbTab
        Next
        Dim mySW As New StringWriter
        With mySW
            .WriteLine(String.Format("{0}ID                                 {1} ({2})", myIdent, ID, ID.GetType.ToString))
            .WriteLine(String.Format("{0}ObjectTypeTemplate_ID              {1} ({2})", myIdent, ObjectTypeTemplate_ID, ObjectTypeTemplate_ID.GetType.ToString))
            .WriteLine(String.Format("{0}Datatype                           {1} ({2})", myIdent, Datatype, Datatype.GetType.ToString))
            .WriteLine(String.Format("{0}FieldDefinition                    {1} ({2})", myIdent, FieldDefinition, FieldDefinition.GetType.ToString))
            .WriteLine(String.Format("{0}EmptyAllowed                       {1} ({2})", myIdent, EmptyAllowed, EmptyAllowed.GetType.ToString))
            .WriteLine(String.Format("{0}SortOrder                          {1} ({2})", myIdent, SortOrder, SortOrder.GetType.ToString))
            .WriteLine(String.Format("{0}IsSystem                           {1} ({2})", myIdent, IsSystem, IsSystem.GetType.ToString))
        End With
        Return mySW.ToString
    End Function
    Public Overrides Function ToString() As String
        Return ToString(0)
    End Function

End Class
